numsLen = int(input())
nums = input().split(' ')
nums.sort()
ans = []

for num in nums:
    ans.append(num)
    while len(ans) > 2 and ans[-1] == ans[-2] == ans[-3]:
        for _ in range(3):
            ans.pop()

print(ans)
